package cn.exrick.xboot.modules.transport.baoxian.dto;

import lombok.Data;

import javax.xml.bind.annotation.*;
import java.math.BigDecimal;

@Data
@XmlRootElement(name = "PolicyList")
@XmlAccessorType(XmlAccessType.FIELD)
public class InsuranceApplicationRequest {

    @XmlAttribute(name = "username")
    private String username; // 开户名

    @XmlElement(name = "Policy")
    private Policy policy = new Policy();

    @Data
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class Policy {
        // -------------------- 业务逻辑 --------------------
        @XmlAttribute(name = "BusinessLogic")
        private String businessLogic = "AddFreightPolicyWeb"; // 固定值 (需MD5校验)

        @XmlElement(name = "PrimaryNo")
        private String primaryNo; // 自定义查询编码 (可选) 填写OrderCarInfo 的id

        @XmlElement(name = "Insurance")
        private String insurance = "国内货物运输保险"; // 固定值 (必填)

        // -------------------- 条款信息 --------------------
        @XmlElement(name = "MainGlauses")
        private String mainClauses = "国内公路货运保险"; // 主险内容 (必填)

        @XmlElement(name = "MainGlausesCode")
        private String mainClauseCode = "YDG001"; // 主险条款代码 (需MD5校验)

        @XmlElement(name = "AdditiveNo")
        private String additiveClauseCodes = "002"; // 附加险代码 (可选，逗号分隔)

        @XmlElement(name = "Additive")
        private String additiveClauses; // 附加险内容 (可选)

        // -------------------- 投保人信息 --------------------
        @XmlElement(name = "HolderName")
        private String holderName = "孙洪军"; // 名称 (必填)

        @XmlElement(name = "HolderDocumentType")
        private String holderDocumentType = "身份证"; // 证件类型 (必填)

        @XmlElement(name = "HolderIdenty")
        private String holderIdentity = "210882197311080036"; // 证件号码 (必填)

        @XmlElement(name = "HolderStartDateValid")
        private String holderStartDateValid = "2008-11-28"; // 证件有效期起 (必填)

        @XmlElement(name = "HolderEndDateValid")
        private String holderEndDateValid = "2028-11-28"; // 证件有效期止 (必填)

        @XmlElement(name = "HolderBirthday")
        private String holderBirthday = "1973-11-08"; // 出生日期 (条件必填)

        @XmlElement(name = "HolderSex")
        private String holderSex = "男"; // 性别 (条件必填)

        @XmlElement(name = "HolderUnitProperties")
        private String holderUnitProperties = "个体"; // 单位性质 (条件必填)

        @XmlElement(name = "HolderLinkMan")
        private String holderLinkMan; // 单位联系人 (条件必填)

        @XmlElement(name = "HolderPhone")
        private String holderPhone = "18611021690"; // 电话 (必填)

        @XmlElement(name = "HolderOverseas")
        private String holderOverseas = "0"; // 是否境外 (必填, 0/1)

        @XmlElement(name = "HolderCountryCode")
        private String holderCountryCode = "CHN"; // 国家地区码 (条件必填)

        @XmlElement(name = "HolderProvince")
        private String holderProvince = "110000"; // 省 (条件必填)

        @XmlElement(name = "HolderCity")
        private String holderCity = "110100"; // 市 (条件必填)

        @XmlElement(name = "HolderCountry")
        private String holderCountry = "110108"; // 县 (条件必填)

        @XmlElement(name = "HolderAddr")
        private String holderAddr = "北京市海淀区创业中路32号楼32-1-1-392"; // 详细地址 (必填)

        // -------------------- 被保险人信息 --------------------
        @XmlElement(name = "RecognizeeName")
        private String recognizeeName = "孙洪军"; // 名称 (必填)

        @XmlElement(name = "RecognizeeAddr")
        private String recognizeeAddr = "北京市海淀区创业中路32号楼32-1-1-392"; // 地址 (必填)

        @XmlElement(name = "DocumentType")
        private String recognizeeDocumentType = "身份证"; // 证件类型 (必填)

        @XmlElement(name = "RecognizeeIdenty")
        private String recognizeeIdentity = "210882197311080036"; // 证件号码 (必填)

        @XmlElement(name = "RecognizeeStartDateValid")
        private String recognizeeStartDateValid = "2008-11-28"; // 证件有效期起 (必填)

        @XmlElement(name = "RecognizeeEndDateValid")
        private String recognizeeEndDateValid = "2028-11-28"; // 证件有效期止 (必填)

        @XmlElement(name = "RecognizeeBirthday")
        private String recognizeeBirthday = "1973-11-08"; // 出生日期 (条件必填)

        @XmlElement(name = "RecognizeeSex")
        private String recognizeeSex = "男"; // 性别 (条件必填)

        @XmlElement(name = "RecognizeeUnitProperties")
        private String recognizeeUnitProperties = "个体"; // 单位性质 (条件必填)

        @XmlElement(name = "RecognizeeLinkMan")
        private String recognizeeLinkMan; // 单位联系人 (条件必填)

        @XmlElement(name = "RecognizeeOverseas")
        private String recognizeeOverseas ="0"; // 是否境外 (必填, 0/1)

        @XmlElement(name = "RecognizeeCountryCode")
        private String recognizeeCountryCode = "CHN"; // 国家地区码 (条件必填)

        @XmlElement(name = "RecognizeeProvince")
        private String recognizeeProvince = "110000"; // 省 (条件必填)

        @XmlElement(name = "RecognizeeCity")
        private String recognizeeCity = "110100"; // 市 (条件必填)

        @XmlElement(name = "RecognizeeCountry")
        private String recognizeeCountry = "110108"; // 县 (条件必填)

        // -------------------- 货物信息 --------------------
        @XmlElement(name = "InvRefNo")
        private String invRefNo; // 发票/运单号 (可选)

        @XmlElement(name = "PackQty")
        private String packQty = "1"; // 包装件数 (必填)

        @XmlElement(name = "GoodsName")
        private String goodsName = "车辆"; // 货物名称 (必填)

        @XmlElement(name = "Weight")
        private String weight; // 重量 (可选)

        @XmlElement(name = "GoodsTypeNo")
        private String goodsTypeNo = "620100"; // 货物类型编码 (需MD5校验)

        // -------------------- 运输信息 --------------------
        @XmlElement(name = "TransportType")
        private String transportType = "公路"; // 运输方式 (必填)

        @XmlElement(name = "Transport")
        private String transport; // 运输工具 (必填)

        @XmlElement(name = "TransportNo")
        private String transportNo; // 航班/航次 (可选)

        @XmlElement(name = "FromLoc")
        private String fromLoc; // 起运地 (必填)

        @XmlElement(name = "ViaLoc")
        private String viaLoc; // 中转地 (可选)

        @XmlElement(name = "ToLoc")
        private String toLoc; // 目的地 (必填)

        @XmlElement(name = "Way")
        private String way; // 争议解决方式 (可选)

        @XmlElement(name = "Deductible")
        private String deductible; // 免赔信息 (可选)

        // -------------------- 时间信息 --------------------
        @XmlElement(name = "DepartureDate")
        private String departureDate; // 起运时间 (需MD5校验, 格式: yyyy-MM-dd:HH)

        @XmlElement(name = "EffDate")
        private String effDate; // 签单时间 (需MD5校验, 格式: yyyy-MM-dd:HH)

        // -------------------- 金融信息 --------------------
        @XmlElement(name = "CurrencyID")
        private String currencyId = "人民币"; // 投保币种 (必填)

        @XmlElement(name = "InsuredAmount")
        private BigDecimal insuredAmount; // 保险金额 (需MD5校验)

        @XmlElement(name = "Ratio")
//        private BigDecimal ratio = new BigDecimal("0.00028"); // 费率 (需MD5校验)
        private BigDecimal ratio = new BigDecimal("0.06"); // 费率 (需MD5校验)

        @XmlElement(name = "EndCurrencyID")
        private String endCurrencyId = "人民币"; // 结算币种 (必填)

        @XmlElement(name = "SpecialAnnounce")
        private String specialAnnounce; // 特别约定 (必填)

        // -------------------- 其他信息 --------------------
        @XmlElement(name = "PolicyNoFile")
        private String policyNoFile; // 附件ID (可选)

        @XmlElement(name = "PrintNum")
        private Integer printNum; // 打印份数 (可选)

        @XmlElement(name = "OtherInfo")
        private String otherInfo; // 备注 (可选)

        // -------------------- 签名字段 --------------------
        @XmlElement(name = "MD5Key")
        private String md5Key; // 签名结果
    }


}
